<template>
	<div class="root">
		<Topbar v-if="$getState('adminInfo','isLogined')" />
		<LeftNav v-if="$getState('navStore','showLeft')" />

		<!-- 子应用 -->
		<div
			id="container"
			:class="{
				'padding-left': $getState('navStore','showLeft')
			}"
		/>
	</div>
</template>

<script>
import { start, registerMicroApps } from 'qiankun'
import Applications from '@root/constants/application'

export default {
  mounted() {
    if (!window.qiankunStarted) {
      window.qiankunStarted = true
      registerMicroApps(Applications)
      start()
    }
  },
  beforeDestroy() {
    window.qiankunStarted = false
  }
}
</script>

<style lang="scss" scoped>
.root {
  #container {
    position: relative;
    height: calc(100vh - #{$topbarHeight});
    overflow-y: auto;

    &.padding-left {
      padding-left: $leftNavWidth;
    }
  }
}
</style>
